/**
 * 计算时间差，用于取消预定时计算取消时间是否距离预定时间超过24小时
 * @param date
 * @param hour
 * @returns
 */
export const calcTimeAway = (date: number, hour: number) => {
    const currentDate = new Date();
    const targetDate = new Date(date);

    // 设置目标日期的小时为指定的小时，分钟、秒和毫秒都设为 0
    targetDate.setHours(hour, 0, 0, 0);
    const timeDiff = targetDate.getTime() - currentDate.getTime();
    const hoursDiff = timeDiff / (1000 * 60 * 60);
    return hoursDiff;
};
